﻿HOW TO CREATE: EF CORE PROJECT
==============================
example is for sqlite but the same works with MsSql


nuget
Microsoft.EntityFrameworkCore.Tools (needed for using Package Manager Console)
Microsoft.EntityFrameworkCore.Sqlite

MIGRATIONS require standard, not core
using standard instead of core. edit 3 things in csproj
1of3: pluralize xml TargetFramework tag to TargetFrameworks
2of2: TargetFrameworks from: netstandard2.1
to: netcoreapp3.0;netstandard2.1
3of3: add
  <PropertyGroup>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
  </PropertyGroup>

run. error
SQLite Error 1: 'no such table: Blogs'.

set project "Set as StartUp Project"

Tools >> Nuget Package Manager >> Package Manager Console
default project: Examples\SQLite_NETCore2_0

PM> add-migration InitialCreate
PM> Update-Database

if add-migration xyz throws and error, don't take the error msg at face value. try again with add-migration xyz -verbose

new sqlite .db file created: Copy always/Copy if newer
or copy .db file to destination

relative:
   optionsBuilder.UseSqlite("Data Source=blogging.db");
absolute  (use fwd slashes):
   optionsBuilder.UseSqlite("Data Source=C:/foo/bar/blogging.db");


REFERENCE ARTICLES
------------------
https://docs.microsoft.com/en-us/ef/core/get-started/netcore/new-db-sqlite
https://carlos.mendible.com/2016/07/11/step-by-step-dotnet-core-and-entity-framework-core/
https://www.benday.com/2017/12/19/ef-core-2-0-migrations-without-hard-coded-connection-strings/